<include file="public/layout" />
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>等级管理</h3>
                <h5>调整用户等级</h5>
            </div>
        </div>
    </div>
    <form class="form-horizontal" id="delivery-form" method="post">
        <input type="hidden" name="user_id" value="{$user_id}"/>
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">会员昵称</dt>
                <dd class="opt">
                    {$user.nickname}
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit">会员等级</dt>
                <dd class="opt">
                    <select name="level" id="level_id"  class="small form-control" onchange="set_agent_city(this.value)">
                        <option value="0">请选择会员等级</option>
                        <foreach name="level_list" item="v" key="k" >
                            <option value="{$v['level_id']}" <if condition="$v['level_id'] eq $user[level]">selected="selected"</if> >
                            {$v['level_name']}
                            </option>
                        </foreach>
                    </select>
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit">
                    操作备注
                </dt>
                <dd class="opt">
                    <textarea name="desc" class="tarea" rows="6">{$_REQUEST['desc']}</textarea>
                    <span class="err"></span>
                    <p class="notic">请输入操作备注</p>
                </dd>
            </dl>
            <input type="hidden" name="user_id" value="{$user_id}"/>
            <div class="bot"><a href="JavaScript:void(0);" onclick="accountForm()" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
        </div>
    </form>
</div>
<script type="text/javascript">

    function clearInput(id){
        $('#'+id).val(0);
    }
    function accountForm(){
        $.ajax({
            type:'post',
            data:$('#delivery-form').serialize(),
            url: "{:U('Admin/User.User/level_update')}",
            dataType:'JSON',
            success: function(data) {
                if(data.status == 1){
                    layer.msg(data.msg, {icon: 1},function(){
                        window.location.href=data.url;
                    });

                }else{
                    layer.alert(data.msg, {icon: 2});
                }
            },
            error:function(){
                layer.alert('网络连接失败，请稍后再试！', {icon: 2});
            }
        });
    }
</script>
</body>
</html>